<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<script type="text/javascript">
		// 用户列表
		function list(){
			let xhr = new XMLHttpRequest()

			xhr.open("get","http://wish.byesame.com/admin?page=1&rows=10")
			// 从本地存储里拿数据 localStorage.getItem("属性名")
			// token 令牌 用户登录之后，后端会返回一串token，登录后的操作都要依据token,token存在且没过期才能继续操作
			xhr.setRequestHeader("token", localStorage.getItem("token"))
				xhr.send()

			xhr.onreadystatechange = function(){
				if (xhr.readyState == 4){
					let res = JSON.parse(xhr.responseText)
					console.log(res)
					console.log(res.data.count)
					console.log(res.data.list)
					for(let i = 0; i <res.data.list.length; i++){
			 			console.log(res.data.list[i].id)
			 			console.log(res.data.list[i].name)
			 			
					
					}
				}
			}
		}
		list()
	</script>
</body>
</html>